package com.zh.note.huawei.onehundred.卡片组成的最大数字;

import java.util.Arrays;
import java.util.Comparator;
import java.util.stream.Collectors;

/**
 * @Author: zhanghuan
 * @date: 2023/8/30 10:12
 * @description: create it
 */
public class Main {
    public static void main(String[] args) {
        // Scanner sc = new Scanner(System.in);
        // String input = sc.nextLine();
        String input = "4589,101,41425,9999";
        String collect = Arrays.stream(input.split(",")).sorted(new Comparator<String>() {
            @Override
            public int compare(String o1, String o2) {
                return Integer.parseInt(o2 + o1) - Integer.parseInt(o1 + o2);
            }
        }).collect(Collectors.joining(""));
        System.out.println(collect);
    }
}
